<?php
   $db = new Database();
   $auth = Auth::getAuth('current_user');
   $userCompany = new userQueries();
   $company = $userCompany->getCompany($auth['company_id']);
   $form_id = $_GET['formID'];
   if($_GET['view_type']=="edit"){
      $form = $db->query("SELECT * FROM tb_workspace WS 
                            WHERE WS.id={$db->escape($form_id)}","row");
      $type = "new";
   }else{
      $form = $db->query("SELECT * FROM tb_generate WS 
                            WHERE WS.id={$db->escape($form_id)}","row");
      $type = "update";
   }
   
?>

<div class="fl-generate-print-wrapper">
	
	<div class="contentBar_workspace">
	    <div class="fl-workspace-wrapper">
			<!-- <div class="fl-option-toolbar">
				<div class="fl-toolbar-left-wrapper">
					<i class="fa fa-list-alt"></i> <span>Generate</span>
				</div>
				<div class="fl-toolbar-right-wrapper">
					<ul class="fl-breadcrums">
						<li><a href="/home"><div class="home icon"></div> <i class="fa fa-caret-right"></i></a></li> 
						<li><a href="/user_view/organizational_chart">Organizational Chart <i class="fa fa-caret-right"></i></a></li> 
						<li><a href="/user_view/formbuilder">Form Builder <i class="fa fa-caret-right"></i></a></li> 
						<li><a href="/user_view/workflow">Workflow</a></li>
					</ul>
				</div>
			</div> -->
			<div class="fl-option-toolbar">
			 <div class="formbuilder_page_btn btn_content">
         <?php
                  if($form_id!=0){
                     if($_GET['view_type']=="edit"){
                        $form_id_a = $_GET['formID'];
                        $form = $db->query("SELECT * FROM tb_workspace 
                                  WHERE id={$db->escape($form_id)}","row");
                     }else{
                        $form_id_a = $_GET['printID'];
                        $form = $db->query("SELECT * FROM tb_generate 
                                  WHERE id={$db->escape($form_id)}","row");
                     }
                     
                  }
                  
               ?>
            </div>
			 <?php
               if($form_id==0){
                  ?>
                  <div class="ws_btn_label  " style="margin-top: 10px;padding-left: 10px;color: gray;/* font-style: italic; */font-size: 10px;">
                     Add Your Button Here.
                  </div>
                  <?php
               }
            ?>
        	</div>
			<div class="fl-workspace">
				 <div style="display:table;">
	         <div style="display:table-row">
	            <div style="display:table-cell"></div>
	            <div class="topPointerRuler-container" style="position:relative; display:table-cell;width: auto;height: 100%;border: 1px solid #ddd;border-bottom: none;">
	                  <div class="topPointerRuler-tip" style="width: 10px;background-color: #000;height: 10px;cursor: pointer;"></div>
	            </div>
	         </div>
	         <div style="display:table-row">
	            <div  class="leftPointerRuler-container" style="position:relative;display:table-cell;white-space:nowrap;vertical-align:top;width: 10px;height: 600px;border: 1px solid #ddd;">
	                  <div class="leftPointerRuler-tip" style="width: 10px;background-color: #000;height: 10px;cursor: pointer;"></div>
	            </div>
	            <div style="display:table-cell">
		     <div class="form-workspace-form-name display"><?php echo $form['form_name'];?></div>
			<div class="form-workspace-json display"><?php echo $form['form_json'];?></div>
			<div class="form-workspace-json-button display"><?php echo $form['form_buttons'];?></div>
	              <div class="workspace formbuilder_ws" style="position:relative">
					<?php
					   if($form_id!=0){
					      echo $form['form_content'];
					   }else{
					      echo $form['form_content'];
					   }
					?>
				     </div>
	            </div>
	         </div>
	      </div><!-- /end of display table -->
		<div class="display">
		    <input type="text" name="FormId" id="FormId" value="<?php echo $form_id; ?>" />
		</div>
			</div><!-- /end of fl-workspace -->
			<?php include 'layout/form_controls.php' ?>
			<!-- <div class="fl-form-properties-wrapper">
				<div class="fl-widget-head">
					<span class="widget-title"><i class="fa fa-cogs"></i> properties</span>
					<div class="fl-form-properties-toggle">
						<i class="fa fa-chevron-right"></i>
					</div>
				</div>
				<div class="fl-props-container">
					<div class="fl-form-setting-wrapper">
						<div class="fl-widget-head">
						    <span class="widget-title">Form Settings</span>
						    <span class="fl-min-max-properties2" fl-show-opt="true"><i class="fa fa-plus"></i></span>
						</div>
						<div class="fl-form-setting-content fl-for-scroll">
							<label>Custom Form Size</label>
							<div class="fl-option-form-wrapper">
								<input type="text" name="" class="form-text form_set_size form_size_width" style="width: 49%;" placeholder="Width" value="1030">
								<input type="text" name="" class="form-text form_set_size form_size_height" style="width: 49%;" placeholder="Height" value="600">
								<div class="clearfix"></div>
							</div>
							<div class="fl-option-form-wrapper">
								<label>Form Size</label>
								<select class="form-select form_size">
								    <option value="8.5x11">Letter(8.5in x 11in)</option> 
								    <option value="8.5x14">Legal(8.5in x 14in)</option> 
								    <option value="7.25x10.5">Executive(7.25in x 10.5in)</option> 
								    <option value="8.27x11.69">A4(8.27in x 11.69in)</option> 
								    <option value="33.11x46.61">A0(33.11in x 46.61in)</option> 
								    <option value="23.39x33.11">A1(23.39in x 33.11in)</option> 
								    <option value="16.53x23.39">A2(16.53in x 23.39in)</option> 
								    <option value="11.69x16.53">A3(11.69in x 16.53in)</option> 
								    <option value="8.27x11.69">A4(8.27in x 11.69in)</option> 
								</select>	
							</div>
							<div class="fl-option-form-wrapper">
								<label>Show Ruler</label><Br/>
								<label>Yes: <input type="radio" class="f-show-ruler" value="yes" name="show-form-ruler-select"/></label>
								<label>No: <input type="radio" class="f-show-ruler" checked="checked" value="no" name="show-form-ruler-select"/></label>
							</div>
						</div>
					</div>
					<div class="fl-form-actions-wrapper">
						<div class="fl-widget-head">
							<span class="widget-title">Form Actions</span>
							<span class="fl-min-max-properties2" fl-show-opt="true"><i class="fa fa-plus"></i></span>
						</div>
						<div class="fl-form-actions-content fl-for-scroll">
							<button class="btn-basicBtn fl-command-btn padding_5 cursor save_workspace" data-workspace="Customize Report" data-form-type="generate" style="width: 49%;font-size: 11px;"><i class="icon-save"></i> Save</button>
							<button class="btn-basicBtn fl-command-btn padding_5 cursor clear_all_formbuilder_workspace" style="width: 49%;font-size: 11px;"><i class="icon-remove"></i> Clear All</button>
							<button class="btn-basicBtn fl-command-btn padding_5 cursor preview_form" data-form-type="generate" style="width: 49%;font-size: 11px;"><i class="icon-search"></i> Preview</button>
						</div>
					</div>
					
					<div class="fl-form-objects-wrapper">
						<div class="fl-widget-head">
							<span class="widget-title">Objects</span>
							<span class="fl-min-max-properties2" fl-show-opt="true"><i class="fa fa-plus"></i></span>
						</div>
						<div class="generate_objects  fl-form-objects-content fl-for-scroll">
							                              
						</div>
					</div>

					<div class="fl-form-htmlvalue-wrapper">
						<div class="fl-widget-head">
							<span class="widget-title">Html Value</span>
							<span class="fl-min-max-properties2" fl-show-opt="true"><i class="fa fa-plus"></i></span>
						</div>
						<div class="tab_objects fl-form-htmlvalue-content fl-for-scroll">
							                              
						</div>
					</div>
				</div>
			</div> --><!-- /end of fl-form-properties -->
			<div class="clearfix"></div>
			<div class="display">
                  <input type="text" name="saveType" id="saveType" value="<?php echo $type; ?>" />
                  <input type="text" name="FormId" id="FormIdPrint" value="<?php echo $form['form_id']; ?>" />
                  <input type="text" name="FormId" id="FormId" value="<?php echo $form_id_a; ?>" />
                  <input type="text" name="FormId" id="requestID" value="<?php echo $_GET['requestID']; ?>" />
                  <input type="text" name="FormId" id="trackNo" value="<?php echo $_GET['trackNo']; ?>" />
               </div>
		</div>
	</div>	
</div>

